package com.cxy.book.controller;

import com.cxy.book.pojo.Book;
import com.cxy.book.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author 蔡心勇
 */
@Controller
public class BookController {
    @Autowired
    private BookService bookService;

    @RequestMapping("/books")
    public ModelAndView books(){
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("books",bookService.list());
        modelAndView.setViewName("bookManage");
        return modelAndView;
    }
}
